<?php
/**
 * Maker: 梁康宁
 * Time: 2019-09-17 15:11:28
*/
namespace app\dlc\controller;
use think\Db;
class ApiTypeController extends CommonController
{
	public function index()
	{
	    $this->headBotton("","add","添加",CONTROLLER_URL . "_edit");
	    $this->headSearch("","name","接口分类名称","1");
	    $this->listBotton("","edit","编辑",CONTROLLER_URL . "_edit",0,"","","","");
	    $this->headSearch("","key","识别名","1");
		$this->loading();
		$map = $this->map();
		$data = model(CONTROLLER_NAME)->where($map)->order('id desc')->page(self::$page)->select();
		$count = model(CONTROLLER_NAME)->where($map)->count();
		$this->getPage($count, self::$psize, 'App-loader', $this->title, 'App-search');
		$this->assign('data',$data);
		$list = ["id"=>"ID","name"=>"接口分类名称","key"=>"识别名","url"=>"相对路径url","api_name"=>"接口name","ctime"=>"创建时间",'sys'=>"操作"];
		$this->assign('list',$list);
		echo $this->fetch('common/index');
	}


	//$funName 添加和编辑成功后的回调方法,返回 $id,$action , $action =add 是添加，$action = edit 是编辑
    public function _edit($updata = false, $add = false, $noRepeat = false, $funName = false)
    {
//        $updata['table'] = "";//更新的表，默认自动获取
//        $updata['key'] = "";//表的主键，默认自动获取
//        $noRepeat['map'] = "";//新增判断条件
//        $noRepeat['name'] = "";//字段，不可重复的字段
//        $noRepeat['tig'] = "";//提示语
        parent::_edit($updata, $add, $noRepeat, $funName);
    }

    public function _del($tabelName = false, $tableKey = 'id', $child = false, $delChild = false)
    {
//        $child['tableName'] = '';//下级表，如果这个是分类表，使用该分类的表   如:goods 是goods_type的下级
//        $child['key'] = '';//外键 如：goods_type_id
//        $child['msg'] = '该分类下有数据，不能删除';//提示语
//        $delChild['tableName'] = '';///下级表，如果这个是分类表，使用该分类的表，删除该分类的数据 如:goods 是goods_type的下级
//        $delChild['key'] = '';//外键 如：goods_type_id
        //$child = ['tableName'=>'shop','key'=>'agent_id','msg'=>'该分类下有数据，不能删除'];
        parent::_del($tabelName, $tableKey, $child, $delChild);
    }

}
?>